// 导入请求拦截器
import request from '@/utils/request'

// 获取企业的部门列表
export function getDepartmentList() {
  return request({
    url: '/company/department',
    method: 'get'
  })
}
// 查询部门详情
export function getDepartmentDetails({ id }) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}
// 添加部门接口
export function addDepartmentDetails({ code, introduce, manager, name, pid }) {
  return request({
    url: '/company/department',
    method: 'post',
    data: {
      code,
      introduce,
      manager,
      name,
      pid
    }
  })
}
// 编辑部门信息
export function alterDepartmentDetails({
  code,
  introduce,
  manager,
  name,
  pid,
  id
}) {
  return request({
    url: `/company/department/${id}`,
    method: 'put',
    data: {
      code,
      introduce,
      manager,
      name,
      pid,
      id
    }
  })
}
// 删除部门
export function delDepartmentDetails({ id }) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
